﻿/******************************************************************************
 Key或变量的的命名规则
 * 
 * 所有的Key 存放在 AllCacheKeys,以 # 隔开 
 * 
 * 获得字符串   Get_  + 此列表中的关键字(可以去掉下划线)
 * 前缀命名：   Prefix 此单词代表 前缀的意思
 * 正则字符串   CacheReg_
 * 站点缓存     Site_
 * 系统全局     Sys_     
 * 动态访问     Dynamic_
 * 
 * 模型的缓存 Model_
 * 程序集缓存 Sys_Assembly_
******************************************************************************/
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data;
using TRPOP.Common;
namespace TRPOP.CMS.Plugin
{
    /// <summary>
    /// 缓存keys
    /// </summary>
    public class CacheKeys
    {
        /// <summary>
        /// 所有的Key 存放在 AllCacheKeys,以 # 隔开 
        /// </summary>
        public const string mAllCacheKeys = "cms_AllCacheKeys";

        public static Dictionary<string, string> GetAllCacheClearKeys()
        {
            Dictionary<string, string> dicList = new Dictionary<string, string>();
            dicList.Add("程序集缓存", Sys_Assembly_AllCaches);
            dicList.Add("内容模型缓存", CacheReg_ModelAll);
            dicList.Add("结点缓存", CacheReg_NodeAll);
            dicList.Add("PSN缓存", CacheReg_PSNAll);
            dicList.Add("录入限制缓存", CacheReg_FormInputLimitTypeAll);
            dicList.Add("动态访问页缓存", CacheReg_DynamicURL);
            dicList.Add("模板缓存", Template_AllKeys);
            return dicList;
        }

        #region 反射程序的缓存  Sys_Assembly_
        /// <summary>
        /// 反射程序缓存 10分钟
        /// </summary>
        public const double SysAssemblyTimeSecond = 60 * 10;
        /// <summary>
        /// 后台用户操作的程序集
        /// </summary>
        public const string Sys_Assembly_AllCaches = @"Sys_Assembly_[\s\S]*";
        /// <summary>
        /// 后台用户操作的程序集
        /// </summary>
        public const string Sys_IAdminUser         = "Sys_Assembly_IAdminUser";
        /// <summary>
        /// 后台用户操作的程序集
        /// </summary>
        public const string Sys_ICommonDALAccess   = "Sys_Assembly_ICommonDALAccess";
        /// <summary>
        /// 后台用户操作的程序集
        /// </summary>
        public const string Sys_ILogAccess         = "Sys_Assembly_ILogAccess";
        /// <summary>
        /// 模板数据处理程序集
        /// </summary>
        public const string Sys_ITemplateDal       = "Sys_Assembly_ITemplateDal";
        /// <summary>
        /// 模板数据处理程序集
        /// </summary>
        public const string Sys_ITemplateFunc     = "Sys_Assembly_ITemplateFunc";
        /// <summary>
        /// 信息点击操作的程序集
        /// </summary>
        public const string Sys_IContentClickAccess = "Sys_Assembly_IContentClickAccess";
        #endregion

        #region 关于模型的缓存 KEY
        /// <summary>
        /// 匹配所有的模型缓存的key 
        /// </summary>
        public const string CacheReg_ModelAll = @"Model_[\S\s]*";
        /// <summary>
        /// 模型的缓存时间 10分钟
        /// </summary>
        public const double ModelTimeSecond = 60 * 10;
        /// <summary>
        /// 列表显示字段列表
        /// </summary>
        public const string Model_TableFieldListDisplayListByNodeId = "Model_TableFieldListDisplayListByNodeId_{0}";
        /// <summary>
        /// 获取标题字段
        /// </summary>
        public const string Model_TableTitleFieldByNodeId = "Model_TableTitleFieldByNodeId_{0}";
        /// <summary>
        /// 获取标题字段
        /// </summary>
        public const string Model_TableTitleFieldByModelId = "Model_TableTitleFieldByModelId_{0}";
        /// <summary>
        /// 获取主内容字段
        /// </summary>
        public const string Model_TableMainFieldByNodeId = "Model_TableMainFieldByNodeId_{0}";
        /// <summary>
        /// 获取主内容字段
        /// </summary>
        public const string Model_TableMainFieldByModelId = "Model_TableMainFieldByModelId_{0}";
        /// <summary>
        /// 获取搜索字段
        /// </summary>
        public const string Model_TableSearchFieldListByNodeId = "Model_TableSearchFieldListByNodeId_{0}";
        /// <summary>
        /// 通过NodeId 获取模型字段
        /// </summary>
        public const string Model_WithTableNameListByNodeId = "Model_WithTableNameListByNodeId_{0}";
        /// <summary>
        /// 通过ModelId 获取模型字段
        /// </summary>
        public const string Model_WithTableNameListByModelId = "Model_WithTableNameListByModelId_{0}";

        /// <summary>
        /// 通过ModelId 获取模型字段
        /// </summary>
        public const string Model_GetInfoById = "Model_GetInfoById_{0}";

        #endregion

        #region 关于结点的缓存 KEY
        /// <summary>
        /// 模型的缓存时间 10分钟
        /// </summary>
        public const double NodeTimeSecond = 60 * 10;
        /// <summary>
        /// 匹配所有的模型缓存的key 
        /// </summary>
        public const string CacheReg_NodeAll = @"(Node_[\S\s]*)|(Template_NodeInfo_[\s\S]*)";//@"Node_[\S\s]*";
        /// <summary>
        /// 获取实体
        /// </summary>
        public const string Node_GetInfoById = "Node_GetInfoById_{0}";
        /// <summary>
        /// 结点树形结构
        /// </summary>
        public const string Node_GetNodeListTree = "Node_GetNodeListTree_{0}_{1}_{2}";
        /// <summary>
        /// 获取结点名
        /// </summary>
        public const string Node_GetNodeNameById = "Node_GetNodeNameById_{0}";
        /// <summary>
        /// 获取结点名
        /// </summary>
        public const string Node_GetNodeIndexPage = "Node_GetNodeIndexPage_{0}";
        /// <summary>
        /// 获取实结点的虚结点
        /// </summary>
        public const string Node_GetVirualNode = "Node_GetVirualNode_{0}";
        /// <summary>
        /// 获取实结点的虚结点
        /// </summary>
        public const string Node_GetIndexPSNPath = "Node_GetIndexPSNPath_{0}";
        /// <summary>
        /// 获取结点下所有子结点
        /// </summary>
        public const string Node_GetNodeListByParentID = "Node_GetNodeListByParentID_{0}";


        #endregion

        #region 关于PSN的缓存 KEY
        /// <summary>
        /// PSN的缓存时间 10分钟
        /// </summary>
        public const double PSNTimeSecond = 60 * 10;


        /// <summary>
        /// 匹配所有的PSN缓存的key 
        /// </summary>
        public const string CacheReg_PSNAll = @"PSN_[\S\s]*";
        /// <summary>
        /// 获取实体
        /// </summary>
        public const string PSN_GetInfoById = @"PSN_GetInfoById_{0}";
        /// <summary>
        /// {PSN:1}/publish
        /// </summary>
        public const string PSN_GetInfoByPSN = @"PSN_GetInfoByPSN_{0}";

        /// <summary>
        /// Http
        /// </summary>
        public const string PSN_GetInfoByHttp = @"PSN_GetInfoByHttp_{0}";
        
        #endregion

        #region 录入限制管理
        /// <summary>
        /// 录入限制的缓存时间 10分钟
        /// </summary>
        public const double FormInputLimitTypeTimeSecond = 60 * 10;
        /// <summary>
        /// 匹配所有的录入限制缓存的key 
        /// </summary>
        public const string CacheReg_FormInputLimitTypeAll = @"FormInputLimitType_[\S\s]*";

        /// <summary>
        /// 获取实体
        /// </summary>
        public const string FormInputLimitType_GetInfoByIdFromCache = @"FormInputLimitType_GetInfoByIdFromCache_{0}";

        #endregion

        #region 动态访问
        /// <summary>
        /// 录入限制的缓存时间 3分钟
        /// </summary>
        public const double DynamicTimeSecond = 60 * 3;
        /// <summary>
        ///  给动态访问页加缓存时必须使用的正则表达式
        /// </summary>
        public const string Dynamic_Prefix = @"Dynamic_";
        /// <summary>
        ///  给动态访问页加缓存时必须使用的正则表达式
        /// </summary>
        public const string CacheReg_DynamicURL = @"Dynamic_[\S\s]*";
        /// <summary>
        /// 获取动态页的缓存Key
        /// </summary>
        /// <param name="strUrl"></param>
        /// <returns></returns>
        public static string Get_Dynamic(string strUrl)
        {
            return Dynamic_Prefix + strUrl;
        }

        #endregion

        #region 模板缓存
        /// <summary>
        /// 模板的缓存时间 5分钟
        /// </summary>
        public const double TemplateTimeSecond = 60 * 5;
        /// <summary>
        /// 模板文件缓存时间
        /// </summary>
        public const double TemplateFileTimeSecond = 60 * 20;
        /// <summary>
        /// list标签 3分钟
        /// </summary>
        public const double TemplateListTimeSecond = 60 * 3;
        /// <summary>
        /// Automini标签 10分钟
        /// </summary>
        public const double TemplateAutominiTimeSecond = 60 * 10;
        /// <summary>
        /// 所有的模板缓存
        /// </summary>
        public const string Template_AllKeys = @"Template_[\s\S]*";


        /// <summary>
        /// 所有的模板缓存
        /// </summary>
        public const string Template_List_AllKeys = @"Template_List_[\s\S]*";

        /// <summary>
        /// 所有的模板缓存
        /// </summary>
        public const string Template_AllContentKeys = @"Template_ContentInfo_IndexID_[\s\S]*";

        /// <summary>
        ///  模板文件缓存
        /// </summary>
        public const string Template_TemplateFile = @"Template_TemplateFile_{0}";
        /// <summary>
        /// 模板内部处理读取文件的缓存
        /// </summary>
        public const string Template_InnerReadFile = @"Template_InnerReadFile_{0}";
        /// <summary>
        /// 模板结点信息缓存
        /// </summary>
        public const string Template_NodeInfo_ID = @"Template_NodeInfo_ID_{0}";
        /// <summary>
        /// 模板结点信息缓存
        /// </summary>
        public const string Template_NodeInfo_GuidID = @"Template_NodeInfo_GuidID_{0}";
        /// <summary>
        ///  结点信息缓存
        /// </summary>
        public const string Template_ContentInfo_IndexID = @"Template_ContentInfo_IndexID_{0}";
        /// <summary>
        /// 外部读取模板文件的缓存 Key
        /// </summary>
        public const string Template_OutReadFile = @"Template_OutReadFile_{0}";
        /// <summary>
        ///  list的count缓存
        /// </summary>
        public const string Template_List_Count = @"Template_List_Count_{0}_{1}_{2}";

        /// <summary>
        ///  list的 列表缓存
        /// </summary>
        public const string Template_List_info = @"Template_List_Info_{0}_{1}_{2}_{3}_{4}_{5}_{6}";
        /// <summary>
        ///  Searchlist的 列表缓存
        /// </summary>
        public const string Template_SearchList_info = @"Template_SearchList_info_{0}_{1}_{2}_{3}_{4}_{5}_{6}_{7}_{8}_{9}_{10}";
        /// <summary>
        ///  Searchlist的 列表缓存
        /// </summary>
        public const string Template_SearchList_Count = @"Template_SearchList_info_{0}_{1}_{2}_{3}_{4}_{5}_{6}_{7}";
        /// <summary>
        /// 模板动态执行代码
        /// </summary>
        public const string Template_ExecuteString = @"Template_ExecuteString_{0}";


        /// <summary>
        /// 模板动态执行代码
        /// </summary>
        public const string Template_Automini = @"Template_automini_{0}_{1}";

        #endregion

    }
}
